home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************************************
- 6/96 bob Updated #includes to support changed GX Library names.
-
- ©1990 - 1996 Apple Computer, Inc.
- All rights reserved.
- ****************************************************************************************************/
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <Memory.h>
- #include <Desk.h>
-
- #include <GXGraphics.h>
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
-
- #include <GXTypes.h>
- #include <GXLayout.h>
- #include "LayoutLibrary.h"
-
- #include "SampleInterface.h"
-
- short MyStrLen(char *x);
- static short MyStrLen(x)
- char *x;
- {
- short c = 0;
- while (*x++) c++;
- return c;
- } /* MyStrLen */
-
- void JustifyGlyph(WindowPtr sampleWindow)
- {
- /* Variables */
- char *myString = "pow-wow";
- gxLayoutOptions gxLayoutOptions;
- gxLine myLine;
- gxPoint myPoint;
- gxRunControls gxRunControls;
- gxShape layout;
- short len, level = 0;
- gxStyle myStyle;
- gxViewPort aViewPort;
-
- /* Initialization */
-
- myPoint.x = ff(30);
- myPoint.y = ff(50);
-
- aViewPort = GXNewWindowViewPort(sampleWindow);
- SetDefaultViewPort(aViewPort);
-
- len = MyStrLen(myString);
- InitializeRunControls(&gxRunControls);
-
- InitializeLayoutOptions(&gxLayoutOptions);
- gxLayoutOptions.width = ff(500);
- gxLayoutOptions.just = 0;
-
- myLine.first.x = myLine.last.x = myPoint.x;
- myLine.first.y = 0;
- myLine.last.y = ff(1000);
- GXDrawLine(&myLine);
-
- myLine.first.x = myLine.last.x = myPoint.x + gxLayoutOptions.width;
- GXDrawLine(&myLine);
-
- myStyle = NewLayoutStyle((char *) "\pWackyTimes2 Roman", ff(50), 0, nil, nil, 0, nil);
-
- layout = GXNewLayout(
- 1, &len, (void *) &myString,
- 1, &len, &myStyle,
- 1, &len, &level,
- &gxLayoutOptions, &myPoint);
- GXDrawShape(layout);
-
- gxLayoutOptions.just = fract1 / 4;
- GXSetLayout(layout, 0, nil, nil, 0, nil, nil, 0, nil, nil, &gxLayoutOptions, nil);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- gxLayoutOptions.just = fract1 / 2;
- GXSetLayout(layout, 0, nil, nil, 0, nil, nil, 0, nil, nil, &gxLayoutOptions, nil);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- gxLayoutOptions.just = 3 * (fract1 / 4);
- GXSetLayout(layout, 0, nil, nil, 0, nil, nil, 0, nil, nil, &gxLayoutOptions, nil);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- gxLayoutOptions.just = fract1;
- GXSetLayout(layout, 0, nil, nil, 0, nil, nil, 0, nil, nil, &gxLayoutOptions, nil);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- GXDisposeShape(layout);
- GXDisposeStyle(myStyle);
- GXDisposeViewPort(aViewPort);
- } /* main */
-